package query_handler

import (
	"file-cleaner/internal/file_cleaner/file_info"
	"time"
)

func (q QueryByATimeImpl) doHandle(info *file_info.FileInfo) bool {
	tt := time.Unix(info.GetStat().Atim.Sec, info.GetStat().Atim.Nsec)
	return tt.After(q.AfterTime) && tt.Before(q.BeforeTime)
}

func (q QueryByCTimeImpl) doHandle(info *file_info.FileInfo) bool {
	tt := time.Unix(info.GetStat().Ctim.Sec, info.GetStat().Ctim.Nsec)
	return tt.After(q.AfterTime) && tt.Before(q.BeforeTime)
}

func (q QueryByMTimeImpl) doHandle(info *file_info.FileInfo) bool {
	tt := time.Unix(info.GetStat().Mtim.Sec, info.GetStat().Mtim.Nsec)
	return tt.After(q.AfterTime) && tt.Before(q.BeforeTime)
}
